from aiohttp import web
from api_module.routes import setup_routes


async def start_init_test(app):
    print("初始化操作")


async def end_init_test(app):
    print("清理操作")


def main():
    app = web.Application()
    setup_routes(app)
    app.on_startup.append(start_init_test)
    app.on_cleanup.append(end_init_test)
    web.run_app(app)


app = web.Application()
setup_routes(app)
app.on_startup.append(start_init_test)
app.on_cleanup.append(end_init_test)
web.run_app(app)

if __name__ == "__main__":
    main()
